package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the module database table.
 * 
 */
@Entity
@NamedQuery(name="Module.findAll", query="SELECT m FROM Module m")
public class Module implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int idModule;

	private String nom;

	//bi-directional many-to-one association to Ue
	@ManyToOne
	@JoinColumn(name="idUE")
	private Ue ue;

	//bi-directional many-to-one association to Note
	@OneToMany(mappedBy="module")
	private List<Note> notes;

	//bi-directional many-to-one association to Typecour
	@OneToMany(mappedBy="module")
	private List<Typecour> typecours;

	public Module() {
	}

	public int getIdModule() {
		return this.idModule;
	}

	public void setIdModule(int idModule) {
		this.idModule = idModule;
	}

	public String getNom() {
		return this.nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public Ue getUe() {
		return this.ue;
	}

	public void setUe(Ue ue) {
		this.ue = ue;
	}

	public List<Note> getNotes() {
		return this.notes;
	}

	public void setNotes(List<Note> notes) {
		this.notes = notes;
	}

	public Note addNote(Note note) {
		getNotes().add(note);
		note.setModule(this);

		return note;
	}

	public Note removeNote(Note note) {
		getNotes().remove(note);
		note.setModule(null);

		return note;
	}

	public List<Typecour> getTypecours() {
		return this.typecours;
	}

	public void setTypecours(List<Typecour> typecours) {
		this.typecours = typecours;
	}

	public Typecour addTypecour(Typecour typecour) {
		getTypecours().add(typecour);
		typecour.setModule(this);

		return typecour;
	}

	public Typecour removeTypecour(Typecour typecour) {
		getTypecours().remove(typecour);
		typecour.setModule(null);

		return typecour;
	}

}